<?php

namespace Main\Api\Admin;

class weiyu extends adminController
{
    /**
     *  获取列表
     *
     * @return void
     */
    public function list(){
		$data['status'] = (int) \FC\get('status');
        $data['limit'] = \FC\input('size',$_GET);
        $data['page'] = \FC\input('page',$_GET);
        $data['order'] = 'desc';
        $data['sname'] = \FC\get('title');
        if($data['sname']){
            $data['skey'] = 'content'; 
        }		
        $res = $this->Model->query($data);
        if($res){
            $count = $res['page']['number'];
            $this->success($res['data'], 'ok',['count'=>$count]);
        }else{
            $this->success('', 'ok',['count'=>0]);
        }
    }
	
    // 隐藏
    public function hidden(){
        $post = \FC\Input($_POST);
        if($post){
            foreach($post as $v){
                $this->Model->checkUpdate(['status'=>2], ['id'=>$v]);
            }
        }
        $this->success('', 'ok');
    }
    
    // 显示
    public function show(){
        $post = \FC\Input($_POST);
        if($post){
            foreach($post as $v){
                $this->Model->checkUpdate(['status'=>1], ['id'=>$v]);
            }
        }
        $this->success('', 'ok');
    }
    
}
